from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import User

class UserRegisterForm(UserCreationForm):
    phone = forms.CharField(max_length=11, required=True, label='手机号')
    address = forms.CharField(widget=forms.Textarea, required=False, label='配送地址')
    
    class Meta:
        model = User
        fields = ['username', 'phone', 'address', 'password1', 'password2']

class UserProfileForm(forms.ModelForm):
    class Meta:
        model = User
        fields = ['username', 'phone', 'address']
        labels = {
            'username': '用户名',
            'phone': '手机号',
            'address': '配送地址'
        }
